<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns:jsf="http://xmlns.jcp.org/jsf"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns="http://www.w3.org/1999/xhtml">    
    <fieldset>
        <legend>Cadastro de Artista</legend>
        <link rel="stylesheet" type="text/css" jsf:name="/style/jquery-picklist.css"/>        
        <script jsf:name="/js/jquery-1.10.2.min.js" type="text/javascript"></script>
        <script jsf:name="/js/jquery.ui.widget.min.js" type="text/javascript"></script>
        <script jsf:name="/js/jquery-picklist.min.js" type="text/javascript"></script>
        <script jsf:name="/js/artist.js" type="text/javascript"></script>
        <f:view>
            <h:form prependId="false" id="form" >            
                <label jsf:for="name">Nome:</label>
                <br/>
                <input type="text" size="60" required="true" jsf:id="name"
                    jsf:value="${artistManagedBean.artist.name}"/>
                <br/>
                <label jsf:for="year">Ano de Criação:</label>
                <br/>
                <input type="number" required="true" jsf:id="year" max="${util.year}" min="1000" 
                    jsf:value="${artistManagedBean.artist.year}" />
                <br/>
                <label jsf:for="genre">Genêro:</label>
                <br/>
                <select jsf:id="genre"  required="true" size="1"
                        jsf:value="${artistManagedBean.artist.genre.id}">
                    <f:selectItem itemValue="" itemLabel="Selecione um genêro..." />
                    <f:selectItems value="${genreManagedBean.list}" var="genre"
                        itemValue="${genre.id}" itemLabel="${genre.name}"/>                                
                </select>                            
                <br/>
                <label jsf:for="city">Cidade:</label>
                <br/>
                <select jsf:id="city" size="1" required="true" 
                        jsf:value="${artistManagedBean.artist.originCity.id}">
                    <f:selectItem itemValue="" itemLabel="Selecione uma cidade..." />
                    <f:selectItems value="${cityManagedBean.list}" var="city"
                        itemValue="${city.id}" itemLabel="${city.description}"/>                                
                </select>                            
                <br/>
                <label jsf:for="musicians">Músicos:</label>
                <br/>
                <select jsf:id="musicians" size="1" multiple="true" style="width: 1px; height: 1px;" required="true"
                        jsf:value="${artistManagedBean.musiciansId}">                        
                    <f:selectItems value="${musicianManagedBean.list}" var="item"
                            itemValue="${item.id}" itemLabel="${item.name}"/>
                </select>                                                  
                <br/>
                <textarea rows="10" cols="100"  maxlength="500" 
                    placeholder="Insira a história..." 
                    required="true" jsf:id="history" 
                    jsf:value="${artistManagedBean.artist.history}"/>
                <br/>
                <input type="submit" class="button" value="Salvar" jsf:action="${artistManagedBean.register}" jsf:id="salvar"/>
                <input type="button" class="button" value="Cancelar" jsf:action="${artistManagedBean.cancel}" jsf:id="cancelar"/>                            
            </h:form>
        </f:view>
    </fieldset>        
</html>

